package com.example.juc.kkb.printab;

public class PrintBySynchronized {
    public static void main(String[] args) {

        MyCondition3 myCondition = new MyCondition3();

        new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                try {
                    myCondition.printA();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "线程A").start();

        new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                try {
                    myCondition.printB();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "线程B").start();
    }
}
